<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>志愿填报</title>
    <script type="text/javascript"  src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script type="text/javascript"  src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="index.css">
  <link rel="stylesheet" href="main.css">
  <link rel="stylesheet" href="volunteer.css">
  <link rel="stylesheet" href="choice_school.css">
  <link rel="stylesheet" href="./static/dist/css/bootstrap.css">
  <script type="text/javascript" src="./static/store.legacy.min.js"></script>
  <script src="./static/util.js"></script>
</head>
<body>
  <!-- 自主招生页面 -->
  <header>
    <div class="headerSwipper">
      <div class="headerSwipper_div">
        <div class="headerSwipper_div_iconview">
          <img src="./static/images/logo.png" alt="">
        </div>
        <div class="headerSwipper_div_myicon">
          <!-- <img src="" alt=""> -->
          <span class="loginText">登录</span>
          <div class="headerSwipper_div_myicon_icon" style="display: none">
            <img src="./static/images/iconsmall.png" alt="">
          </div>
          <div class="headerSwipper_div_myicon_info">
            <ul>
              <li class="headerSwipper_div_myicon_info_li">消息</li>
              <li class="headerSwipper_div_myicon_info_li">退出</li>
            </ul>
          </div>
        </div>
        <ul class="headerSwipper_div_ul">
          <li class="headerSwipper_div_li mobileapp">手机APP</li>
          <li class="headerSwipper_div_li vipprop">开通VIP</li>
        </ul>
      </div>
    </div>
  </header>
  <section>
    <div class="ImgSwipperview">
      <img class="ImgSwipperview_img" src="./static/images/mainSwipper.png" alt="">
    </div>
  </section>
  <section>
    <div class="mainContentView">
      <div class="contentView">
        <!-- 上侧导航 -->
        <div class="topnav">
          <ul class="contentView_ul">
            <li class="contentView_li">首页</li>
            <li class="contentView_li">学习中心</li>
            <li class="contentView_li contentView_li_active">志愿填报</li>
            <li class="contentView_li">微课</li>
            <li class="contentView_li">模拟试题</li>
            <li class="contentView_li">往届真题</li>
            <li class="contentView_li">咨询</li>
          </ul>
          <div class="inputview">
            <input class="inputview_input" id="tag" 
 type="text" placeholder="搜索院校">
            <img  class="searchicon_img" src="./static/images/searchicon.png" alt="">
          </div>
        </div>
      </div>
    </div>
  </section>
  <!-- 院校大全筛选 -->
  <section>
    <div class="choiceSchool">
      <div class="chschoolview">
        <div class="tabelview">
          <!-- <p class="questionItems_topnav"><span class="questionItems_topnav_span questionItems_topnav_span_active clearborderRight">按分数查询</span><span class="questionItems_topnav_span">按名次查询</span></p> -->
          <form id="filter_data">
          <p class="choice_filter choice_filter_noborder">
              <span class="rangeText">分数范围</span>
              <input type="text" placeholder="请输入" name="low_score">
              <span>-</span>
              <input type="text" class="clearLright" placeholder="请输入" name="high_score">
              <span>分</span>
              <input type="text" class="major_input" placeholder="请输入专业名称" name="zy_id">
              <select name="obj_status" id="sub">
                <option value="1">理科</option>
                <option value="2">文科</option>
              </select>
              <select name="year" id="date">
                <option value="0">请选择招生年份</option>
                <option value="2017">2017</option>
                <option value="2018">2018</option>
                <option value="2019">2019</option>
                <option value="2020">2020</option>
              </select>
              <span class="search_span">搜索</span>
            </p>
          </form>
          <!-- <p class="comfires">请选择上面的条件查询院校数据</p> -->
          <table class="table table-bordered schoolshow">
            
          </table>
          <!-- 分页 来自index.html -->
          <p class="pagingView">
            <span class="pagebtn firstpage">首页</span>
            <span class="pagebtn frontpage">前一页</span>
            <span class="pagesview">
              <!-- 动态添加页码 -->
            </span>
            <span class="pagebtn backpage">后一页</span>
            <span class="pagebtn lastpage">尾页</span>
          </p>
        </div>
      </div>
    </div>
  </section>



  <footer>
    <div class="footerSwipper">
      <div class="footerSwipper_div">
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span"><a href="./index.html">首页</a></span>
          <li class="footerSwipper_div_ul_li"><a href="./schools.html?keyword=">院校大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./major.html">专业大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mentality.html">心理辅导</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./careerPlanning.html">职业规划</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./infoTest.html">高考资讯</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=1">自主招生</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=2">单独招生</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">学习提升</span>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=3">微课</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=4">模拟试题</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=5">往届试题</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">志愿填报</span>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=6">咨询</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mobileapp.html">下载APP</a></li>
        </ul>
        <!-- 扫一扫关注我们区域 -->
        <div class="QRcodeSwipper">
          <span class="QRcodeSwipper_span">扫一扫关注我们</span>
          <div class="QRcodeSwipper_imgview">
            <img src="./static/images/qr.png" alt="">
          </div>
        </div>
        <!-- 中间信息区域 -->
        <div class="middleInfo">
          <span class="middleInfo_span_city">中国·河南·郑州</span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special phone_icon"><img src="./static/images/phone.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_color">0371-68064945</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/message.png" alt=""></span><span class="middleInfo_span_GE_text">595879735@qq.com</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/store.png" alt=""></span><span class="middleInfo_span_GE_text">河南柒佰伴教育信息咨询有限公司
          </span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special address_icon"><img src="./static/images/address.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_special">郑州市郑东新区立体世界
            </span></span>
        </div>
        <p class="footerSwipper_div_p">河南世霖网络软件科技 2014-2018 豫ICP备14010456号-1</p>
      </div>
    </div>
  </footer>
  <script src="./static/util.js"></script>
  <script>
    $(document).ready(function(){
      // 初始化参数
      var testQuestion = {
        zy_id: '',
        year: '',
        obj_status: '',
        low_score: '',
        high_score: '',
        page: 1
      }
      var pagestotal = 1
      var currentpage = 1
      $('.pagingView').hide()
      // 登录隐藏
      $('.headerSwipper_div_myicon_info').hide()
      // 页面首页初始化
      ArrowNavigation($('.chschoolview'), ['zhiyuan','major'])
      function pageinit () {
      }
      pageinit()
      // li标签点击 需要跳转页面 同时传递第几个 进行初始化
      $('body').on('click', '.contentView_li', function () {
        var index = $(this).index()
        window.location.href = './index.html?index=' + index
      })
      // 监听搜索事件
      $('.tabelview').on('click', '.search_span', function() {
        var form_data = $('#filter_data').serializeArray()
        testQuestion.low_score = form_data[0].value
        testQuestion.high_score = form_data[1].value
        testQuestion.zy_id = form_data[2].value
        testQuestion.obj_status = form_data[3].value
        testQuestion.year = form_data[4].value
        ajaxdata(testQuestion)
      })
      // 渲染数据方法
      function ajaxdata (init) {
        $.ajax({
          url: urlhost + '/admin.php/api/users/zy_lq',
          method: 'POST',
          data: init,
          success: function(res){
            if(res.code == '0') {
              tabelRender(res.data)
              if(res.last_page) {
                $('.pagingView').show()
                changeInitPage(res.last_page, 1)
              }
            }
          }
        })
      }
      // 页码数据方法
      function pagedata (init) {
        $.ajax({
          url: urlhost + '/admin.php/api/users/zy_lq',
          method: 'POST',
          data: init,
          success: function(res){
            console.log(res)
            if(res.code == '0') {
              tabelRender(res.data)

            }
          }
        })
      }
      function tabelRender (data) {
        var html_td = '<tr>'
           + '<td style="width: 420px;">院校</td>'
           + '<td>录取批次</td>'
           + '<td>录取人数</td>'
          + ' <td>最低分</td>'
        + ' </tr>'
        var html_th = ''
        var yx_majorlist = ['','本科一批','本科二批','高职高专']
        for(var i=0; i < data.length; i++) {
          html_th += '<tr>'
               + '<th style="width: 420px;">'+ data[i].sch_name +'</th>'
               + '<th>'+ yx_majorlist[data[i].yx_major_status] +'</th>'
               + '<th>'+ data[i].yx_lq_num +'</th>'
               + '<th>'+ data[i].yx_low_score +'</th>'
             + '</tr>'
        }
        html_th = html_td + html_th
        $('.table-bordered').html(html_th)
      }
      // 监听上选择事件 questionItems_topnav_span
      $('.choiceSchool').on('click', '.questionItems_topnav_span', function() {
        testQuestion.status = Number($(this).index())+1
        if($(this).index() == 0) {
          $('.rangeText').text('分数范围')
        }else {
          $('.rangeText').text('名次范围')
        }
        clickchange($(this), '.questionItems_topnav_span', 'questionItems_topnav_span_active')
        $('.schoolshow').html('')
      })
      // 全局页码初始化改变方法
      function changeInitPage (a, b) {
        currentpage = b
        currentRender = b
        pagestotal = a
        pagefuc(pagestotal, currentRender)
      }
      // 页码方法
      function pagefuc (pagestotal, currentpage){
        // 页面初始化方法
        function init(pagestotal, currentpage) {
          if(pagestotal <= 5) {
            var html = ''
            $('.pagesview').html('')
            for(var i=1; i <= pagestotal; i++) {
              if(i == currentpage) {
                html += '<span class="pageitem pageactive" id="' + i + '">' + i + '</span>'
              }else {
                html += '<span class="pageitem" id="' + i + '">' + i + '</span>'
              }
            }
            $('.pagesview').html(html)
          }else {
            var html = ''
            $('.pagesview').html('')
            var length = (Math.floor(currentpage/5)+1)*5 >= pagestotal?pagestotal:Math.floor(currentpage/5)*5+5
            for(var i=(Math.floor((currentpage-1)/5)+1)*5-4; i <= length; i++) {
              if(i == currentpage) {
                html += '<span class="pageitem pageactive" id="' + i + '">' + i + '</span>'
              }else {
                html += '<span class="pageitem" id="' + i + '">' + i + '</span>'
              }
            }
            $('.pagesview').html(html)
          }
        }
        init(pagestotal, currentpage)
        }
        pagefuc(pagestotal, currentpage)
         // 点击页码事件 页码变色 进行获取数据
      $('.pagingView').on('click', '.pageitem', function() {
        if($(this).hasClass('pageactive')) {
          return
        }
        $(this).parent().find('.pageitem').removeClass('pageactive')
        $(this).addClass('pageactive')
        currentpage = Number($(this).text())
        testQuestion.page = currentpage
        pagedata(testQuestion)
      })
      // 前一页事件
      $('.frontpage').click(
       function() {
          if(currentpage === 1) {
            return
          }
          if($('.pageactive').index() === 0) {
            $('#'+(currentpage+4)).remove()
            currentpage--
            $(this).parent().find('.pageitem').removeClass('pageactive')
            $('.pagesview').prepend('<span class="pageitem pageactive" id="' + currentpage + '">' + currentpage + '</span>')
            testQuestion.page = currentpage
            pagedata(testQuestion)
            return
          }
          currentpage--
          $(this).parent().find('.pageitem').removeClass('pageactive')
          $('#'+currentpage).addClass('pageactive')
          testQuestion.page = currentpage
          var dataNow =  ''
          pagedata(testQuestion)
        }
      )
      // 后一页事件
      $('.backpage').click(
         function() {
          console.log(currentpage)
          if(currentpage === pagestotal) {
            return
          }
          if($('.pageactive').index() === 4) {
            $('#'+(currentpage-4)).remove()
            currentpage++
            $(this).parent().find('.pageitem').removeClass('pageactive')
            $('.pagesview').append('<span class="pageitem pageactive" id="' + currentpage + '">' + currentpage + '</span>')
            testQuestion.page = currentpage
            pagedata(testQuestion)
            return
          }
          currentpage++
          $(this).parent().find('.pageitem').removeClass('pageactive')
          $('#'+currentpage).addClass('pageactive')
          testQuestion.page = currentpage
          var dataNow =  ''
          pagedata(testQuestion)
        }
      )
      // 首页事件
      $('.firstpage').click(
         function() {
          currentpage = 1
          testQuestion.page = currentpage
          var dataNow =  ''
          pagedata(testQuestion)
          changeInitPage(pagestotal, currentpage)
        }
      )
      // 末尾页点击事件
      $('.lastpage').click(
         function() {
          currentpage = pagestotal
          testQuestion.page = currentpage
          pagedata(testQuestion)
          changeInitPage(pagestotal, currentpage)
        }
      )
    })
  </script>
  </body>
</html>
